# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudControlsPartner.V1.Model.Violation do
  @moduledoc """
  Details of resource Violation

  ## Attributes

  *   `beginTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time of the event which triggered the Violation.
  *   `category` (*type:* `String.t`, *default:* `nil`) - Output only. Category under which this violation is mapped. e.g. Location, Service Usage, Access, Encryption, etc.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Output only. Description for the Violation. e.g. OrgPolicy gcp.resourceLocations has non compliant value.
  *   `folderId` (*type:* `String.t`, *default:* `nil`) - The folder_id of the violation
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Format: `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
  *   `nonCompliantOrgPolicy` (*type:* `String.t`, *default:* `nil`) - Output only. Immutable. Name of the OrgPolicy which was modified with non-compliant change and resulted this violation. Format: `projects/{project_number}/policies/{constraint_name}` `folders/{folder_id}/policies/{constraint_name}` `organizations/{organization_id}/policies/{constraint_name}`
  *   `remediation` (*type:* `GoogleApi.CloudControlsPartner.V1.Model.Remediation.t`, *default:* `nil`) - Output only. Compliance violation remediation
  *   `resolveTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time of the event which fixed the Violation. If the violation is ACTIVE this will be empty.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. State of the violation
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last time when the Violation record was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :beginTime => DateTime.t() | nil,
          :category => String.t() | nil,
          :description => String.t() | nil,
          :folderId => String.t() | nil,
          :name => String.t() | nil,
          :nonCompliantOrgPolicy => String.t() | nil,
          :remediation => GoogleApi.CloudControlsPartner.V1.Model.Remediation.t() | nil,
          :resolveTime => DateTime.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:beginTime, as: DateTime)
  field(:category)
  field(:description)
  field(:folderId)
  field(:name)
  field(:nonCompliantOrgPolicy)
  field(:remediation, as: GoogleApi.CloudControlsPartner.V1.Model.Remediation)
  field(:resolveTime, as: DateTime)
  field(:state)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.CloudControlsPartner.V1.Model.Violation do
  def decode(value, options) do
    GoogleApi.CloudControlsPartner.V1.Model.Violation.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudControlsPartner.V1.Model.Violation do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
